<template>
  <el-row :gutter="40" class="panel-group">
    <el-col class="card-panel-col">
      <div class="card-panel">
        <div
          class="
            card-header
            d-flex
            justify-content-between
            align-items-start
            pb-0
          "
        >
          <div>
            <h4 class="card-title mb-1">新增订单</h4>
          </div>
          <div class="dropdown chart-dropdown" style="width: 150px">
            <el-select v-model="value" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </div>
        </div>
        <div class="row">
          <div class="col-sm-12">
            <div class="card-panel-content">
              <div class="row">
                <div class="metric-content col-sm-2">
                  <div
                    class="d-flex flex-column flex-wrap text-center"
                    style="padding-left: 28px"
                  >
                    <h1 class="font-lg-2">162</h1>
                    <small>Tickets</small>
                  </div>
                </div>
                <div class="col-sm-10 d-flex justify-content-center">
                  <div id="chart"></div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="card-panel-footer">
          <div
            class="d-flex justify-content-between p-1"
            style="padding-top: 0 !important"
          >
            <div class="text-center">
              <p>新订单</p>
              <span class="font-lg-1">29</span>
            </div>
            <div class="text-center">
              <p>付款订单</p>
              <span class="font-lg-1">63</span>
            </div>
            <div class="text-center">
              <p>退款订单</p>
              <span class="font-lg-1">25</span>
            </div>
          </div>
        </div>
      </div>
    </el-col>
    <!-- <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('messages')">
        <div class="card-panel-icon-wrapper icon-message">
          <svg-icon icon-class="message" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">Messages</div>
          <count-to
            :start-val="0"
            :end-val="81212"
            :duration="3000"
            class="card-panel-num"
          />
        </div>
      </div>
    </el-col> -->
    <!-- <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('purchases')">
        <div class="card-panel-icon-wrapper icon-money">
          <svg-icon icon-class="money" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">Purchases</div>
          <count-to
            :start-val="0"
            :end-val="9280"
            :duration="3200"
            class="card-panel-num"
          />
        </div>
      </div>
    </el-col> -->
    <!-- <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('shoppings')">
        <div class="card-panel-icon-wrapper icon-shopping">
          <svg-icon icon-class="shopping" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">Shoppings</div>
          <count-to
            :start-val="0"
            :end-val="13600"
            :duration="3600"
            class="card-panel-num"
          />
        </div>
      </div>
    </el-col> -->
  </el-row>
</template>

<script>
// import CountTo from "vue-count-to";
import ApexCharts from "apexcharts";
export default {
  // components: {
  //   CountTo,
  // },
  data() {
    return {
      options: [
        {
          value: "选项1",
          label: "Last 7 Days",
        },
        {
          value: "选项2",
          label: "Last 28 Days",
        },
        {
          value: "选项3",
          label: "Last Month",
        },
        {
          value: "选项4",
          label: "Last Year",
        },
      ],
      value: "Last 7 Days",
    };
  },
  mounted() {
    var opt = {
      chart: {
        height: 280,
        type: "radialBar",
      },

      series: [83],
      colors: ["#20E647"],
      plotOptions: {
        radialBar: {
          hollow: {
            margin: 0,
            size: "70%",
            background: "#293450",
          },

          dataLabels: {
            showOn: "always",
            name: {
              offsetY: -10,
              show: true,
              color: "#fff",
              fontSize: "13px",
            },
            value: {
              color: "#fff",
              fontSize: "30px",
              show: true,
            },
          },
        },
      },
      // 填充track
      fill: {
        type: "gradient",
        gradient: {
          shade: "dark",
          type: "vertical",
          gradientToColors: ["#87D4F9"],
          stops: [0, 100],
        },
      },
      stroke: {
        lineCap: "round",
      },
      labels: ["付款比例"],
    };

    var chart = new ApexCharts(document.querySelector("#chart"), opt);

    chart.render();
  },
  methods: {
    handleSetLineChartData(type) {
      this.$emit("handleSetLineChartData", type);
    },
  },
};
</script>
<style lang="scss" scoped>
.card-title {
  font-size: 1.2rem;
}
.card-title {
  float: left;
  font-size: 1.1rem;
  font-weight: 400;
  margin: 0;
}
.mb-1,
.my-1 {
  margin-bottom: 1rem !important;
}
.card-title {
  margin-bottom: 0.75rem;
}
.card .card-header {
  padding: 1.1rem 1.1rem 0;
  align-items: center;
  display: flex;
  /* justify-content: space-between; */
}
.card-header:first-child {
  border-radius: calc(0.5rem - 1px) calc(0.5rem - 1px) 0 0;
}
.card-header {
  background-color: transparent;
  border-bottom: 0;
  padding: 0.75rem 1.25rem;
  position: relative;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}
.pb-0,
.py-0 {
  padding-bottom: 0 !important;
}
.align-items-start {
  align-items: flex-start !important;
}
.card-panel-footer {
  height: 96px;
}
.card-panel-content {
  display: flex;
}
body {
  line-height: 1.45rem;
}
.text-center {
  text-align: center !important;
}
.flex-wrap {
  flex-wrap: wrap !important;
}
.flex-column {
  flex-direction: column !important;
}
.justify-content-between {
  justify-content: space-between !important;
}
.p-1 {
  padding: 1rem !important;
}
.text-center {
  text-align: center !important;
}
.font-lg-1 {
  font-size: 2rem !important;
}
.breadcrumb,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6,
.header-navbar,
.navigation,
body,
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: Nunito, Montserrat, system-ui, BlinkMacSystemFont, -apple-system,
    sans-serif;
}
.d-flex {
  display: flex !important;
}
.el-col-sm-2 {
  width: 8.3333333333%;
}
.font-lg-2 {
  font-size: 3rem;
  display: block;
  margin-top: 0.2rem;
  margin-bottom: 0;
}
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -14px;
  margin-left: -14px;
}
.panel-group {
  margin-top: 18px;

  .card-panel-col {
    margin-bottom: 32px;
  }
  .card-panel-header {
    width: 8rem;
    color: #000;
    font-weight: 400;
    font-size: 1.32rem;
    margin: 0;
  }
  h1 {
    font-family: Nunito, Montserrat, system-ui, BlinkMacSystemFont,
      -apple-system, sans-serif;
    font-weight: 500;
  }
  *,
  :after,
  :before {
    box-sizing: border-box;
  }
  .card-panel {
    display: flex;
    flex-direction: column;
    // height: 108px;
    // width: 480px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.05);

    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-message {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-shopping {
        background: #34bfa3;
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3;
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@media (max-width: 550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
